package com.tlgen.adapter;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.tlgen.data.TabItemModel;

import java.util.List;

public class ContentPagerAdapter extends FragmentPagerAdapter {

    private List<TabItemModel> tabIndicators;
    private List<Fragment> tabItemList;

    public ContentPagerAdapter(FragmentManager fm, List<TabItemModel> tabIndicators, List<Fragment> tabItemList) {
        super(fm);
        this.tabIndicators = tabIndicators;
        this.tabItemList = tabItemList;
    }

    @Override
    public Fragment getItem(int position) {
        return tabItemList.get(position);
    }

    @Override
    public int getCount() {
        return tabItemList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabIndicators.get(position).getTabTitle();
    }
}

